Edit Distance Algorithm Explanation